import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author 86187
 * @classname PageServlet
 * @time 2024/3/18
 * @project javaweb_project
 */
@WebServlet("/page")
public class PageServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doGet(req, resp);
        resp.setContentType("text/html");
        PrintWriter out=resp.getWriter();
        out.println("<!DOCTYPE html>");
        out.println("<html>");
        out.println("<head>");
        out.println("<title>这是一个简单的网页</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>欢迎来到我的网页</h1>");
        out.println("<p>Welcome !</p>");
        out.println("</body>");
        out.println("</html>");
    }
}


